handles rows and squares