Improved listener calling code.