Use existing readFile from fs.hh instead of copy&pasted implementation with fstream.
Some cleanup and comments.

- Use spaces in "if (" and "for (", and indent split lines with two spaces.
- Remove some useless repetition.
- Add FIXMEs for spots that are broken and need to be fixed.