Reviewed multithreading and added logging facility