clean tree struct code