adding templates, modifying code to handle amd, commonjs, and browser exports.