made it multi threaded