better update or insert mechanism