Added the option to pass a maximum number of rows to process.