max_rows settings and cleanups