Makes validate_settings function more generic, and simplifies the settings sections function.