 		get("/repos/\(repoFullName)/pulls/\(repoNumber)", fromServer: r.apiServer, ignoreLastSync: false, parameters: nil, extraHeaders: nil) { [weak self] response, data, error in
 
 			if error == nil {
-				if let mergeInfo = N(data, "merged_by") as? [NSObject: AnyObject] {
-					DLog("detected merged PR: %@", r.title)
-
-					let mergeUserId = N(mergeInfo, "id") as? NSNumber ?? -2
-					DLog("merged by user id: %@, our id is: %@", mergeUserId, r.apiServer.userId)
-
-					let mergedByMyself = mergeUserId.isEqualToNumber(r.apiServer.userId ?? -1)
-
-					if !(mergedByMyself && Settings.dontKeepPrsMergedByMe) {
-						self!.prWasMerged(r)
-					} else {
-						DLog("will not announce merged PR: %@", r.title)
-					}
+				if let mergeInfo = N(data, "merged_by") as? [NSObject: AnyObject], mergeUserId = N(mergeInfo, "id") as? NSNumber {
+					self!.prWasMerged(r, byUserId: mergeUserId)
 				} else {
 					self!.prWasClosed(r)
 				}
 			} else {
-				let resultCode = response?.statusCode ?? 0
-				if resultCode == 404 || resultCode==410 { // PR gone for good
+				if let resultCode = response?.statusCode where resultCode == 404 || resultCode==410 { // PR gone for good
 					self!.prWasClosed(r)
 				} else { // fetch problem
 					r.postSyncAction = PostSyncAction.DoNothing.rawValue // don't delete this, we couldn't check, play it safe

		}
	}

	private func prWasMerged(r: PullRequest) {
		DLog("detected merged PR: %@", r.title)
		if Settings.mergeHandlingPolicy==PRHandlingPolicy.KeepAll.rawValue || (Settings.mergeHandlingPolicy==PRHandlingPolicy.KeepMine.rawValue && (r.sectionIndex?.integerValue ?? 0)==PullRequestSection.Mine.rawValue) {
			r.postSyncAction = PostSyncAction.DoNothing.rawValue // don't delete this
			r.condition = PullRequestCondition.Merged.rawValue
			app.postNotificationOfType(PRNotificationType.PrMerged, forItem: r)
		}
	}

	private func prWasClosed(r: PullRequest) {
		DLog("Detected closed PR: %@", r.title)
		if Settings.closeHandlingPolicy==PRHandlingPolicy.KeepAll.rawValue || (Settings.closeHandlingPolicy==PRHandlingPolicy.KeepMine.rawValue && (r.sectionIndex?.integerValue ?? 0)==PullRequestSection.Mine.rawValue) {
			r.postSyncAction = PostSyncAction.DoNothing.rawValue // don't delete this
			r.condition = PullRequestCondition.Closed.rawValue
			app.postNotificationOfType(PRNotificationType.PrClosed, forItem:r)
		}
	}

	private func issueWasClosed(i: Issue) {
		DLog("Detected closed Issue: %@", i.title)
		if Settings.closeHandlingPolicy==PRHandlingPolicy.KeepAll.rawValue || (Settings.closeHandlingPolicy==PRHandlingPolicy.KeepMine.rawValue && (i.sectionIndex?.integerValue ?? 0)==PullRequestSection.Mine.rawValue) {
			i.postSyncAction = PostSyncAction.DoNothing.rawValue // don't delete this
			i.condition = PullRequestCondition.Closed.rawValue
			app.postNotificationOfType(PRNotificationType.IssueClosed, forItem:i)
		}
	}


		let f = NSFetchRequest(entityName: "Issue")
		f.predicate = NSPredicate(format: "postSyncAction == %d and condition == %d", PostSyncAction.Delete.rawValue, PullRequestCondition.Open.rawValue)
		f.returnsObjectsAsFaults = false

		for i in moc.executeFetchRequest(f, error: nil) as! [Issue] {
			let r = i.repo
			if !(r.hidden?.boolValue ?? false) && ((r.postSyncAction?.integerValue ?? 0) != PostSyncAction.Delete.rawValue) && r.apiServer.syncIsGood {
				issueWasClosed(i)
			}
		}
	}

