changed to multithreaded model