refactored event listener in user profile