 			}
 		}
 
-		let key = "\(route.hashValue)"
+		let key = route.hashValue
 		return manager.request(request).responseJSON { [weak self] response in
 			if let interval = self?.retryInterval where response.response?.statusCode >= 500 && route.retryOnFailure() {
-				var attempt: Int = self?.attempts.objectForKey(key) as? Int ?? 1
-				self?.attempts.setObject(++attempt, forKey: key)
-				if attempt < self!.maximumAttempt {
+                var attempt: Int = self?.attempts.objectForKey(key) as? Int ?? 0
+                attempt += 1
+				self?.attempts.setObject(attempt, forKey: key)
+				if attempt < self?.maximumAttempt {
 					return delay(interval) {
 						self?.query(route, completionHandler: completionHandler)
 					}
 				} else {
-					print("Maximum attempt reached for request \(route)")
+					print("Maximum attempt \(attempt)/\(self?.maximumAttempt) reached for request \(route)")
 				}
 			}
 			self?.attempts.removeObjectForKey(key)

	private var attempts = NSCache()
	internal var maximumAttempt: Int = 5
    private let manager: Manager

	public typealias GeneratedCodeResponse = (deviceCode: String, userCode: String, verificationUrl: String, expiresAt: NSDate, interval: NSTimeInterval)
	public typealias JSONHash = [String: AnyObject!]

		self.token = token
	}

	internal func query(route: TraktRoute, completionHandler: Response<AnyObject, NSError> -> Void) -> Request! {
		let request = route.URLRequest
		request.setValue("\(traktApiVersion)", forHTTPHeaderField: "trakt-api-version")
		request.setValue(clientId, forHTTPHeaderField: "trakt-api-key")

		if route.needAuthorization() {
