arbitrary insertion algorithm finished