Updated row-reading loop, reducing duplicate code. Fixes #7.

Simplified the loop that reads each row, reducing duplicate code.

This allowed for a simple fix to #7.