improve the settings function