Better test coverage and event handling