Refactored for performance. Added checks for node environment.
Changed arguments check to pass length for significant performance boost in IE.