Add min and max row options

Also fixed leaking global declaration `rows` in event handler. If you don't accept this PR, then at least go in and fix that leaking variable.