refactoring winning row logic