Refactored user-related code in header view