Improved the saveProfile() method