Improvements to input handling