abstracted readInput()