Refactored user profile functions