Removed stream gobbler and refactored to common code. Fixed error reporting in the upgrade command.