Added code to listener