Refactor event handler registration

m6