Refactored parsum into separate classs for nodes and leaves.