Refactor the settings builder and make it more flexible.