function to process raw user input