added a debug mode and changed the event property to type