Adds Sergio's need-ahead optimization of tree_insert