started adding multithreading functionality