Fixed the base URI.
Better exception handling
Added code to recognize authentication errors