updated write_settings to be generic