added modification to support global listener