added event listener. getting stack overflow error