Refactored creation of main file so it can be done programmatically.
Fix to use empty()
Cleanup of commented code.
Merge pull request #227 from murrekatt/mainfile

Refactor out interactive stdin from MainFile creation.