refactoring to support multiple engines