Cleanup

For one, an exclusive lock was being held for far too long, so I shortened it some.

Also, the Published event wasn't being called for QoS 2, only for QoS1. I fixed that.

As a side note, I noticed that you're not actively developing this tool. I work for [2lemetry](https://github.com/m2mIO/) which is an m2m provider. I would be glad to take over this repository - I think we could ensure it's continued development even if I get bored of it.