fixed compile errors, improved readInFile