adding the function for getting used row and column.