build an event system from scratch