added tests
added support for amd and commonjs