 
 open class Node {
     
+    let max = 8
+    
+    let boundingBox: MKMapRect
+    
     struct Siblings {
+        let northWest: Node
         let northEast: Node
-        let northWest: Node
+        let southWest: Node
         let southEast: Node
-        let southWest: Node
     }
-    
-    private(set) var annotations = [MKAnnotation]()
-    
-    let boundingBox: Bounds
     
     var siblings: Siblings?
     

        return siblings == nil
    }
    
    let max = 8
    
    init(boundingBox box: Bounds) {
        boundingBox = box
    }
    
    func canAppendAnnotation() -> Bool {
        return annotations.count < max
    }
    
    func append(annotation: MKAnnotation) -> Bool {
        if canAppendAnnotation() {
            annotations.append(annotation)
            return true
        }
        return false
    }
    
    func makeSiblings() -> Siblings {
        let box = boundingBox
        let northEast = Node(boundingBox: MKMapRect(x0: box.xMid, y0: box.y0, xf: box.xf, yf: box.yMid))
        let northWest = Node(boundingBox: MKMapRect(x0: box.x0, y0: box.y0, xf: box.xMid, yf: box.yMid))
        let southEast = Node(boundingBox: MKMapRect(x0: box.xMid, y0: box.yMid, xf: box.xf, yf: box.yf))
        let southWest = Node(boundingBox: MKMapRect(x0: box.x0, y0: box.yMid, xf: box.xMid, yf: box.yf))
        return Siblings(northEast: northEast, northWest: northWest, southEast: southEast, southWest: southWest)
    }
    
}

extension MKMapRect {
    var minX: Double { return MKMapRectGetMinX(self) }
    var minY: Double { return MKMapRectGetMinY(self) }
    var midX: Double { return MKMapRectGetMidX(self) }

    var maxX: Double { return MKMapRectGetMaxX(self) }
    var maxY: Double { return MKMapRectGetMaxY(self) }
}
