Added register event handler function.