adds a main function in preperation of accepting args

Basically adds a main function.
Ugly pull request, I know, due to indenting change.