changed relay function to accept event name