accessing 2D arrays properly