minor tweak
removing utils duplicate code
factorize batch queries