event based rewrite

small core with everything going through events
we handle pings in a different way, so this can be deleted