Refactors Message Queue CLI module

Also fixes a bug in the message queue client.
Merge pull request #167 from sudorandom/issue-144

Refactors Message Queue CLI module