adding tree size code