added debugging to the events