Added simple error check
Try to re-login on authorization error
Added caching of session id