came up with reasonably fast subtree size calculation method