base engine and state management