handle input from stdin