Just a note, but these ``if (!substitute(t))`` are almost certainly bugs in logic too.