Fixed a bug involving the row loop, still doesn't work yet