factored printing of input out into its own function