Refactor stopListening