further refactored event tracking