ok, i modified my code according to your suggestions. i put the snippet on http://no-subject.org/event_handler.snippet (because i'm too lazy re-editing it here. ;)
i haven't tested it yet, so there might be some smaller bugs, but in principle, it represents the compromise we were talking about.