created event handling and corrected misunderstanding