added check for same row/column