added error checking to make sure file is inputed.