add listener back to main function