Fix n^2 behavoir in number of files. Fix read() loop.