Added isEmptyRow check in order to see if a row is empty.