Removes redunant code from settings.sh and adds extra diagnostics