rewrite some stuff with events and models