Changed all occurrences of x to row and y to col to avoid confusion