Rework the logic for setting the TargetName. This appears to