added calculation of all nodes at tree level