         return blockquoteRect
     }
     
-    private func drawNestedBlockquote(in rect: CGRect, with context: CGContext, at depth: Int) {
+    private func drawBlockquoteBorder(in rect: CGRect, with context: CGContext, at depth: Int) {
         
         let quoteCount = blockquoteBorderColors.count
-        let index = depth < quoteCount ? depth : quoteCount-1
+        let index = min(depth, quoteCount-1)
         
         if blockquoteBorderColors.indices.contains(index) {
             let borderColor = blockquoteBorderColors[index]

                let lineEndsParagraph = lineCharacters.isEndOfParagraph(before: lineCharacters.endIndex)
                let blockquoteRect = self.blockquoteRect(origin: origin, lineRect: rect, blockquoteIndent: blockquoteIndent, lineEndsParagraph: lineEndsParagraph)

                self.drawBlockquote(in: blockquoteRect.integral, with: context)
                
                //nested blockquote
                let nestDepth = paragraphStyle.blockquoteNestedIndent.depth

        let extraIndent = paragraphStyle.blockquoteIndent
        let extraRect = blockquoteRect(origin: origin, lineRect: extraLineFragmentRect, blockquoteIndent: extraIndent, lineEndsParagraph: false)

        drawBlockquoteBackground(in: extraRect.integral, with: context)
        drawBlockquoteBorder(in: extraRect.integral, with: context, at: 0)
    }


