Last commit before insert change

This is the last commit before the improvement of the insert algorithm.