added eventhandler + debug
added event handler