     }
 
     public func append(element: Element) {
+        if let isOrderedBefore = self.isOrderedBefore {
+            for (index, otherElement) in self.values.enumerate() {
+                if isOrderedBefore(lhs: element, rhs: otherElement) {
+                    self.values.insert(element, atIndex: index)
+                    self.executeWithAllHandlers({ handler in
+                        handler.insert?(element, at: index)
+                    })
+                    return
+                }
+            }
+        }
+
         self.values.append(element)
         let index = self.values.count - 1
         self.executeWithAllHandlers({ handler in

        observer observer: AnyObject,
        onDidInsert: DidInsert? = nil,
        onDidRemove: DidRemove? = nil,
        onDidRemoveAll: DidRemoveAll? = nil
        )
    {
        guard onDidInsert != nil || onDidRemove != nil || onDidRemoveAll != nil else {
            return
        }

        let handlers: ObservationHandlers = (insert: onDidInsert, remove: onDidRemove, removeAll: onDidRemoveAll)
        if let index = self.index(ofObserver: observer) {
            self.observers[index].handlers.append(handlers)
        }

    public typealias DidInsert = (Element, at: Int) -> ()
    public typealias DidRemove = (Element, at: Int) -> ()
    public typealias DidRemoveAll = (oldValues: [Element]) -> ()
    public typealias DidMove = (Element, from: Int, to: Int) -> ()
    public typealias ObservationHandlers = (insert: DidInsert?, remove: DidRemove?, removeAll: DidRemoveAll?, didMove: DidMove?)

    private var observers: [(observer: WeakWrapper, handlers: [ObservationHandlers])] = []
    private var onHasObserversChanged: ((Bool) -> ())?
    private var isOrderedBefore: ((lhs: Element, rhs: Element) -> Bool)?

    public private(set) var values: [Element]

