Is there any way to make this multithreaded?