Refactor the listeners