first implementation of insert