Finished insertSort algorithm