Remove commented code and improve efficiency

When expanding a tree, only expand the boundary rather than every node, to reduce run time for large trees.