Modified iteration through data frame