Clean up

Probably this pull-request, will need some more love, before you will want to merge it, but I had a couple of issues, which I couldn't immediately localize, like dropped errors randomly resurfacing. And ended up simplifying and cleaning up the code a bit.

Are you interested in merging these changes? Do I have to break them up into smaller chunks? I didn't write any tests demonstrating the issues.

Thanks