added specialized reshapes for 2d and 3d to speed things up