multiple refactors (encapsulation, readability, modularity, pep8)

* Should fix test breakage.
* Stopping from the Web UI was broken.
Use BitMessage together with the context.