added a method in the listener to change the external class