Fixed some mistakes
Row address calculated
i is looped the correct no of times
k is looped the correct no of times
Whole thing is in. Just doesn't seem to like ram values
Revert "Whole thing is in. Just doesn't seem to like ram values"

This reverts commit 780f75b833c96c4bdf857371fc2299397f119b66.