Completed thread control and moving the main thread to the APIs.