refactor all the event data crunching into its own model, and migrate the tests