Refactored entity engine to be an actual ENGINE.