Gived the gravity logic, it was operating on columns (which become rows when the matrix is rotated.