Implement starting thread and refactor helpers.