improved handling of user input