implements listener mechanism