Tidied up prepare.sh a bit