finish remove-tree-class and refactor a little