Added custom message handler to support different events for header and body