 							name: NSManagedObjectContextObjectsDidChangeNotification,
 							object: self_.context)
 					}
-				}
-    }
-
-    context.performBlock {
-      let asyncRequest = NSAsynchronousFetchRequest(fetchRequest: self.fetchRequest, completionBlock: completionBlock)
-
-      do {
-        try self.context.executeRequest(asyncRequest)
-      } catch let error as NSError {
-        fatalError("\(error.description)")
-      }
-    }
-  }
-
-  private func sectionize(fetchedObjects: [E]) {
-    guard let keyPath = sectionNameKeyPath else {
-      sections = [ObjectSetSection(name: ReactiveSetSectionName(nil),
-        array: fetchedObjects)]
-
-      return
-    }
+			}
+		}
+
+		context.performBlock {
+			let asyncRequest = NSAsynchronousFetchRequest(fetchRequest: self.fetchRequest, completionBlock: completionBlock)
+
+			do {
+				try self.context.executeRequest(asyncRequest)
+			} catch let error as NSError {
+				fatalError("\(error.description)")
+			}
+		}
+	}
+
+	private func sectionize(fetchedObjects: [E]) {
+		guard let keyPath = sectionNameKeyPath else {
+			sections = [ObjectSetSection(name: ReactiveSetSectionName(nil),
+				array: fetchedObjects)]
+
+			return
+		}
 
 		if !fetchedObjects.isEmpty {
 			var ranges: [(range: Range<Int>, name: ReactiveSetSectionName)] = []
 
 			// Objects are sorted wrt to sections already.
-      for position in fetchedObjects.startIndex ..< fetchedObjects.endIndex {
-        let sectionName = ReactiveSetSectionName(fetchedObjects[position].valueForKeyPath(keyPath) as? String)
+			for position in fetchedObjects.startIndex ..< fetchedObjects.endIndex {
+				let sectionName: ReactiveSetSectionName
+
+				switch fetchedObjects[position].valueForKeyPath(keyPath) {
+				case let name as String:
+					sectionName = ReactiveSetSectionName(name)
+				case let name as NSNumber:
+					sectionName = ReactiveSetSectionName(name.stringValue)
+				default:
+					sectionName = ReactiveSetSectionName(nil)
+				}
 
 				if ranges.isEmpty || ranges.last?.name != sectionName {
 					ranges.append((range: position ..< position + 1, name: sectionName))
 				} else {
 					ranges[ranges.endIndex - 1].range.endIndex += 1
 				}
-      }
+			}
 
 			sections.reserveCapacity(ranges.count)
 

			}
		}

    isFetched = true
  }
  
  private func sectionNameFor(object: E) -> ReactiveSetSectionName {
    if let keyPath = self.sectionNameKeyPath {
      return ReactiveSetSectionName(object.valueForKeyPath(keyPath) as? String)
    }
    return ReactiveSetSectionName(nil)
  }
  
  private func shouldInclude(object: NSManagedObject) -> E? {
    if object.entity.name == entity.name {
      if fetchRequest.predicate?.evaluateWithObject(object) ?? true {
        return object as? E
      }
    }
    return nil
  }

  /// Merge changes since last posting of NSManagedContextObjectsDidChangeNotification.
  @objc private func mergeChangesFrom(notification: NSNotification) {
    if let changes = extractExternalChangesFrom(notification) {
      apply(changes)
    }
  }
  
  private func extractExternalChangesFrom(notification: NSNotification) -> ExternalChanges<E>? {
    guard let userInfo = notification.userInfo else {
      return nil
    }

    var notification = ExternalChanges<E>()

    if let insertedObjects = userInfo[NSInsertedObjectsKey] as? Set<NSManagedObject> {
      for object in insertedObjects {
        if let object = shouldInclude(object) {
          let sectionName = sectionNameFor(object)
          notification.insertedObjects.insert(object, inSetForKey: sectionName)
					notification.insertedObjectsCount = notification.insertedObjectsCount + 1
        }
      }
    }

    if let deletedObjects = userInfo[NSDeletedObjectsKey] as? Set<NSManagedObject> {
      for object in deletedObjects {
        if let object = shouldInclude(object) {
          let sectionName = sectionNameFor(object)
					notification.deletedObjects.insert(object, inSetForKey: sectionName)
					notification.deletedObjectsCount = notification.deletedObjectsCount + 1
        }
      }
    }

    if let updatedObjects = userInfo[NSUpdatedObjectsKey] as? Set<NSManagedObject> {
      for object in updatedObjects {
        if let object = shouldInclude(object) {
					let sectionName: ReactiveSetSectionName

          if sectionNameKeyPath != nil {
						let __object: E = _sectionNameKeyPath!.count > 1
              ? object.valueForKeyPath(_sectionNameKeyPath!.first!) as! E
              : object

            sectionName = sectionNameFor(object)

						let changedDict = __object.changedValuesForCurrentEvent()
						if changedDict.keys.contains(_sectionNameKeyPath!.last!) {


								continue
							}
						}
					} else {
						sectionName = ReactiveSetSectionName(nil)
					}

					notification.updatedObjects.insert(object, inSetForKey: sectionName)
					notification.updatedObjectsCount = notification.updatedObjectsCount + 1
				}
			}
		}

		return notification
	}

	private func apply(externalChanges: ExternalChanges<E>) {
		let oldSections = sections
		var updatedSections = sections

		var inboundObjects = [ReactiveSetSectionName: ContiguousArray<E>](minimumCapacity: externalChanges.movedObjects.count)
		var originsOfMoved = ContiguousArray<NSIndexPath>()
		originsOfMoved.reserveCapacity(externalChanges.movedObjectsCount)

		var indexPathsOfInsertedRows = [NSIndexPath]()
		var indexPathsOfDeletedRows = [NSIndexPath]()
