Use 1D arrays instead of 2D