added subroutine get_next_row