Modified the program to have input as file objects.