             root: root,
             size: size - 1,
             depth: depth - 1,
-            contract_on: div(size, @node_size),
-            expand_on: div(trie(dict, :expand_on), @node_size))
+            contract_on: div(size, unquote(node_size)),
+            expand_on: div(trie(dict, :expand_on), unquote(node_size)))
         else
           trie(dict, size: size - 1, root: root)
         end

  end

  defp node_fold(node, depth, acc, fun, count) when count >= 1 do
    acc = node_fold(:erlang.element(count, node), depth - 1, acc, fun, @node_size)
    node_fold(node, depth, acc, fun, count - 1)
  end


  defp dict_put(trie(root: root, depth: depth, size: size, expand_on: size, contract_on: contract_on) = dict, key, value) do
    root = node_expand(root, depth, depth + 1)
    dict = trie(dict, root: root, depth: depth + 1,
      expand_on: size * unquote(node_size), contract_on: contract_on * unquote(node_size))
    dict_put(dict, key, value)
  end

