Changed setup_config.sh to use the updated logic from the previous few commits and separated the logic into a separate file.