Handle removes in the TreeFlattener
remove dead code