How to use the listen function