Refactored engine