Hooked up main and some file reading refactoring.
Some minor refactoring.