yarn application listener added and refactored code