add callback to listen function and a test