Corrected logic for first in row