Why did you change this logic from the snippet i sent you, see SettingsProperty.beautify in core