   g = new CodeGenerator(s)
   g.debug=false
   
-  appendRewriteOnce = eval g.generateAppendRewriteOnce()
+  rewriterCode = g.generateAppendRewriteOnce()
+  console.log rewriterCode
+  appendRewriteOnce = eval rewriterCode
   throw new Error("Rewriter failed to compile") unless appendRewriteOnce?
   
   appendRewrite = repeatRewrite appendRewriteOnce    

    
    for [suffix, rewrite] in ruleset.items()
        gSuffix = groupPowersVd(suffix)
        gSuffix.reverse()
        gRewrite = groupPowersVd(rewrite)
        gRewrite.reverse()
        if ignorePowers
            if gSuffix.length is 1 and gRewrite.length is 1 and gSuffix[0][0] is gRewrite[0][0]
                continue

        @block =>
            @line("//Non-trivial rewrites, when new element is #{newElement}")
            nodeConstructor=@_nodeClass(newElement)
            o = @_nodeOrder newElement
            mo = @_lowestPower newElement
            @line("chain = new #{nodeConstructor}((((power - #{mo})%#{o}+#{o})%#{o}+#{mo}), chain);")            
            @generateRewriteBySuffixTree(newElement, @suffixTree, 'chain')
            
    generateRewriteBySuffixTree: ( newElement, suffixTree, chain)->
