Fixed error in tree expand/contract methods.

Expansion and contraction were off by a factor of 2.