Improvements to input handling for states.