Use 'max' as the limit rather than a hardcoded number

In case the limit ever changes, the code doesn't need to be updated.
Merge pull request #1 from legoktm/patch-1

Use 'max' as the limit rather than a hardcoded number