Moved cleanup script to the end so other stuff can complete.
Removed unneeded apt-get update.
Added a sh -x for debugging.