Cleanup the main function
Merge pull request #24 from heatherleaf/fixmain

Cleanup the main function