Fixed issue with iterating the wrong number of rows

Next issue to tackle is the right to left being swapped.