major refactoring to submodules.

it's easier to maintain, and now I know how to build submods.
added AMD build.
AMD and CommonJS builds are now updated.
added the AMD build to npm ignore.