Some work on file reading.
Some changes to fix compilation problems.