create event, cleaned up code