Adjusted row checking code

Row checking didn't seem to work the way I wrote it before. wrote a
less-clever and also much less efficient way to check.