Support for tracing ast rewriting and checking conditions

o Condition checking still needs testing but the hot code path is tested
This could be done with a foldLeft, right?