Cleaned up input file parsing code.

I made my comments nicer-looking, and I added some TODOs.