Implemented multithreading