     }
 
     /**
-     CacheContainer instance is stored to instance of NSString as associated object.
+    CacheContainer instance is stored to instance of NSString as associated object.
     */
     private var cacheContainer: CacheContainer {
         if let cache = objc_getAssociatedObject(self, &keyCacheContainer) as? CacheContainer {

                return element.range.location
            } else if element.byteRange.length == diff {
                return NSMaxRange(element.range)
            } else {
                let endUTF16index = element.line.content.utf8.startIndex.advancedBy(diff)
                .samePositionIn(element.line.content.utf16)!
                let utf16Diff = element.line.content.utf16.startIndex.distanceTo(endUTF16index)
                return element.range.location + utf16Diff
            }
        }

        /**
         Returns UTF8 offset from UTF16 offset
         - parameter location: UTF16 based offset of string
         - returns: UTF8 based offset of string
        */
        func byteOffsetFromLocation(location: Int) -> Int {
            if self.rangesAndLine.isEmpty {
                return 0
            }
            guard let index = rangesAndLine.indexOf({ NSLocationInRange(location, $0.range) }) else {


extension NSString {
    /**
    CacheContainer caches:

    - UTF16-based NSRange
    - UTF8-based NSRange
    - Line
    */
    @objc private class CacheContainer: NSObject {
        struct RangesAndLine {
