Cleanup refactoring in main

Not sure how you feel about cosmetic pull requests, so I'll just throw this out here. Please flame, reject, etc. if this is a waste of time!