added maxrows option