cleaned up code for file input
cleaned up input code