Also moving the code further up in the function so that it's consistent with how the other settings are handled.