implimented the file reader