made the code a bit easier to read, added docs and the scripts and data files needed to run the example.
Added ability to specify broker host and make the debug messages a bit more clear.