Genericise registering event handlers