Added file reading and input directing.