             levelDBIteratorGetKey(iterator, &iKey, &iKeyLength);
             #if swift(>=3.0)
                 if let iKey = iKey {
-            #endif
-            if let prefix = prefix {
+                if let prefix = prefix {
                 if memcmp(iKey, prefix.cString, min(prefix.length, iKeyLength)) != 0 {
-                    break
-                }
-            }
-            if let iKeyString = NSString(bytes: iKey, length: iKeyLength, encoding: stringEncoding) as? String {
+                break
+                }
+                }
+                if let iKeyString = NSString(bytes: iKey, length: iKeyLength, encoding: stringEncoding) as? String {
                 let getter : () -> NSObject? = {
-                    #if swift(>=3.0)
-                        var iData: UnsafeMutableRawPointer? = nil
-                    #else
-                        var iData: UnsafeMutableRawPointer = nil
-                    #endif
-                    var iDataLength: Int = 0
-                    levelDBIteratorGetValue(iterator, &iData, &iDataLength);
-                    #if swift(>=3.0)
-                        if let iData = iData {
-                    #endif
-                    return self.decoder(iKeyString, NSData(bytes: iData, length: iDataLength));
-                    #if swift(>=3.0)
-                        } else {
-                        return nil
-                        }
-                    #endif
+                var iData: UnsafeMutableRawPointer? = nil
+                var iDataLength: Int = 0
+                levelDBIteratorGetValue(iterator, &iData, &iDataLength);
+                return self.decoder(iKeyString, NSData(bytes: iData, length: iDataLength));
                 };
                 block(iKeyString, getter, &stop);
-            }
-            #if swift(>=3.0)
+                }
+                }
+            #else
+                if let prefix = prefix {
+                    if memcmp(iKey, prefix.cString, min(prefix.length, iKeyLength)) != 0 {
+                        break
+                    }
+                }
+                if let iKeyString = NSString(bytes: iKey, length: iKeyLength, encoding: stringEncoding) as? String {
+                    let getter : () -> NSObject? = {
+                        var iData: UnsafeMutableRawPointer = nil
+                        var iDataLength: Int = 0
+                        levelDBIteratorGetValue(iterator, &iData, &iDataLength);
+                        return self.decoder(iKeyString, NSData(bytes: iData, length: iDataLength));
+                    };
+                    block(iKeyString, getter, &stop);
                 }
             #endif
             if (stop) {

            levelDBIteratorGetKey(iterator, &iKey, &iKeyLength)
            #if swift(>=3.0)
                if let iKey = iKey {
            #endif
            if prefixLen > 0 {
                if memcmp(iKey, prefixPtr, min(prefixLen, iKeyLength)) != 0 {
                    break;
                }
            }
            levelDBItemDelete(db, iKey, iKeyLength)
            #if swift(>=3.0)
                }
            #endif
            levelDBIteratorMoveForward(iterator)
        }
        levelDBIteratorDelete(iterator)

        }
        #if swift(>=3.0)
            if let rawData = rawData {
            let data = NSData(bytes: rawData, length: rawDataLength)
            return decoder(key, data)
            } else {
            return nil
            }
        #else
            let data = NSData(bytes: rawData, length: rawDataLength)
            return decoder(key, data)
        #endif
    }
    
