Added callback to insert which yields the ID of the record created. Fixed bugs