edited thread_controller