Refactor listener classes.