multithreading and cleanup