Refactored code to fetch profile information