Add a way to unregister event handlers
Added more test cases and cleaned a few warnings