move check_input() below main routine