Update to update.sh

- Added logging
- more error checking
- cleaner code