Added missing state change functionality