Rewrote setup.sh to use functions

After fresh pull as recommended by JT.