Wrote a base for insert function (untested)