class Engine - refactored