Moved boilerplate code from main to the engine's game class.