 					var etag: String? = nil
 					if let allHeaders = response?.allHeaderFields {
 
+                        etag = allHeaders["Etag"] as? String
+
 						fromServer.requestsRemaining = NSNumber(longLong: (allHeaders["X-RateLimit-Remaining"] as! NSString).longLongValue)
 						fromServer.requestsLimit = NSNumber(longLong: (allHeaders["X-RateLimit-Limit"] as! NSString).longLongValue)
 						fromServer.resetDate = NSDate(timeIntervalSince1970: (allHeaders["X-RateLimit-Reset"] as! NSString).doubleValue)
 						NSNotificationCenter.defaultCenter().postNotificationName(API_USAGE_UPDATE, object: fromServer, userInfo: nil)
-
-						let etag = allHeaders["Etag"] as? String
 					}
-					callback(data: data, lastPage: API.lastPage(response), resultCode: code, etag: etag)
+                    var lastPage = true
+                    let allHeaders = response?.allHeaderFields as [NSObject : AnyObject]?
+                    if let linkHeader = N(allHeaders, "Link") as? String {
+                        lastPage = linkHeader.rangeOfString("rel=\"next\"") == nil
+                    }
+					callback(data: data, lastPage: lastPage, resultCode: code, etag: etag)
 				} else {
 					callback(data: nil, lastPage: false, resultCode: code, etag: nil)
 				}

		}
	}

	private func fetchPullRequestsForRepos(repos: [Repo], toMoc:NSManagedObjectContext, callback: Completion) {

		for r in Repo.unsyncableReposInMoc(toMoc) {
			for p in r.pullRequests {

		}
	}

	private func fetchIssuesForRepos(repos: [Repo], toMoc: NSManagedObjectContext, callback: Completion) {

		for r in Repo.unsyncableReposInMoc(toMoc) {
			for i in r.issues {
