rewrote inserted to be able to use more than one core for insert