Temporary fix on dynamically resizing the tree; will fix thoroughly later