         case .internal(let children):
             // recursively add children's points that lie in the rect
             for childNode in children {
-                result.append(contentsOf: childNode.points(inRect: rect))
+                result.append(contentsOf: childNode.annotations(in: rect))
             }
         }
         

    }
    
    struct Children: Sequence {
        let leftTop: QuadTreeNode
        let leftBottom: QuadTreeNode
        let rightTop: QuadTreeNode
        let rightBottom: QuadTreeNode
        
        init(parentNode: QuadTreeNode) {
            leftTop = QuadTreeNode(rect: parentNode.rect.leftTopRect)
            leftBottom = QuadTreeNode(rect: parentNode.rect.leftBottomRect)
            rightTop = QuadTreeNode(rect: parentNode.rect.rightTopRect)
            rightBottom = QuadTreeNode(rect: parentNode.rect.rightBottomRect)
        }
        
        struct ChildrenIterator: IteratorProtocol {


import MapKit

protocol AnnotationsContainer {
    func add(_ annotation: MKAnnotation) -> Bool
    func annotations(in rect: MKMapRect) -> [MKAnnotation]
}

class QuadTreeNode {
