Made a number of improvements to the insert program.