Cursor movement, and 1d to 2d array translation