Code refactor in ProfilePage.