better comments on delegated events, and move related functions together