Add edit function to events