first working version of insert