moved event summary code to a macro