added code to handle input from file