Refactor write_handler for settings_data.c