Now uses the StateManager to register states