added max_rows kwarg