Improved StateManager and enabled state switching