let new_tempid = 
  let id_cnt = ref 0 in
  fun () -> incr id_cnt; !id_cnt