refactored the creation of stage listener