refactored engine classes