Refactor internal event filter