Can this be made more generic, so that future changes to the metrics don't need a code change. Similar to before comment, maybe iterate through a list of events