Tidy up for deploy.sh to use functions