Added some file checking to input file. Documented some code.