Added AMD and CommonJS exports (by Satya).