Moving some more methods and their dependencies into the engine class.