Removed trailing spaces
Ran JSHint
updated to UMD compliant using AMD or browser globals for fallback.