Implement sumtree