Add support for registering events