Add amd & commonjs exports, fix #1