wrote most of insert_tuple - JM