Improved functionality when a state changes