Refactor scheduler and engine control threads for ease of use