Add tree size and update functions