Completed initial code to read rows