refactored event process. See wiki for documentation