refact symmetric tree code