Engines: Minor improvements and refactoring