refactored event registration / detachment