Changed tree update mechanism and fixed line wrapping

This patch improves the performance of the tree by having a better update mechanism and it will fix the line wrapping issue.