Be a bit more robust about env var names.
Removed vestigal 'upgrade' file.
Updated refresh script.