moved event routing into its own class