Fixed CommonJS support.
Simplified/fixed AMD support.