Make sure event unsubscription works correctly.
Enhance testing setup
Some minor cleanup