B-48943 Added class comments to the handler factory, refactored getListeners code