Refactorings and parallel insert into DB