Add test for invalid path to readFile.
Refactor duplicate flag checks