Handle user input