More engine refactoring.