refactory formatProfile method