added initial support for events
removed the assumption that keySet is in fact a Set. it can be an ordered collection as well