Refactored Main and Mains to make the bulk of them unit testable.
Added UTs for Main (multiplexed) and Mains (multithreaded).
UTs pass.

git-svn-id: svn://graphite/hackamore/trunk/Hackamore@131 57787f05-46dc-4277-aca0-fea81b7b9c9c