2d array improvement