Added tools from r.js and utilized them to extract config from main config file, and cleaned up template.