Moved the input code into it's own source file