add batch insert and finish delete logic