Neater implementation of chunkBy2