before changing to multithreading