Improved user input handling