row logic