Refactored function apply_profile()