 }
 
 extension Trie {
-  private mutating func remove
-    <G : GeneratorType where G.Element == Element>
-    (var g: G) -> Bool { // Return value signifies whether or not it can be removed
+  private mutating func remove<
+    G : GeneratorType where G.Element == Element
+    >(var g: G) -> Bool { // Return value signifies whether or not it can be removed
       if let head = g.next() {
-        if children[head]?.remove(g) == true {
-          children.removeValueForKey(head)
-          return !endHere && children.isEmpty
-        } else {
-          return false
-        }
-      } else {
-        endHere = false
-        return children.isEmpty
-      }
-  }
-  public mutating func remove
-    <S : SequenceType where S.Generator.Element == Element>
-    (seq: S) {
+        guard children[head]?.remove(g) == true else { return false }
+        children.removeValueForKey(head)
+        return !endHere && children.isEmpty
+      }
+      endHere = false
+      return children.isEmpty
+  }
+  public mutating func remove<
+    S : SequenceType where S.Generator.Element == Element
+    >(seq: S) {
       remove(seq.generate())
   }
 }

  private var curEnd  : Bool = false
  private var innerGen: (() -> [Element]?)?
  private mutating func update() {
    if let (head, child) = children.next() {
      curHead = head
      var g = child.generate()
      innerGen = {g.next()}
      curEnd = child.endHere
    } else {
      innerGen = nil
    }
  }
  public mutating func next() -> [Element]? {
    for ; innerGen != nil; update() {

*/

public extension Trie {
  private func contains<
    G : GeneratorType where G.Element == Element
    >(var gen: G) -> Bool {
      guard let head = gen.next() else { return endHere }
      return children[head]?.contains(gen) ?? false
  }
