Extract the profile building to a method.