Added state management.