More improvements to the update-script. Getting really hacky now, must re-factor at some point.