Moved listener.activate() out of while loop.