Docs and AMD to JS

added docs for functions
converted to AMD to prevent window littering