moves input reading code to bottom