Merge pull request #48 from murrekatt/main_cleanup

Cleanup of variable naming and consts.
Rearranged ProcessMessage function flow for clarity and less nesting.