update event listern logic to pipe and unpipe events