Renamed maxlinks param to maxLinks for consistency.
Fixed typo in a variable name.
Rewriting the array forEach shim code to use a standalone function, rather than extending the array prototype.
Moved the checking for document.querySelectorAll support to the beginning of the code.