almost done with insert, see TODOs