exports.init = function(grunt, options) {
    'use strict';

    //import libs
    var requirejs = require('requirejs');
    var _ = require('lodash');

    //by default, we load config file from project dir but we allow this to be overridden
    defaultOptions = {
        settingsFileName: 'settings.js',
        projectPath: 'project/',
        requireConfig: 'jam/require.config.js'
    };

    //setup empty options in case it wasn't passed in
    var options = _.extend({}, defaultOptions, options);

    //project file paths
    var requireConfigPath = options.projectPath + options.requireConfig;

    //recursively searches the project folder for a matching settings file
    function getSettingsFilePath() {
        var settingsPath;
        // Guess settingsPath
        if (grunt.file.exists(options.settingsFileName)) {
            settingsPath = options.settingsFileName;
        } else {
            var found = grunt.file.expand('*/' + options.settingsFileName)
            if (found.length) {
                settingsPath = found[0];
            }
        }
        return settingsPath;
    }

    function getSettingsModule() {
        //get settings Path and check valid
        var settingsPath = getSettingsFilePath();
        if (grunt.file.exists(settingsPath)) {
            grunt.log.writeln('Using ' + settingsPath);
        } else {
            //exit with task error
            grunt.warn('Cant find ' + options.settingsFileName, 3);
        }
        var settings = requirejs(settingsPath);
        return settings;
    };

    function getModulePaths(settings) {
        // Get requireJS config to be able to resolve module paths.
        var config;
        if (grunt.file.exists(requireConfigPath)) {
            //use the require config generated by jam
            config = require(requireConfigPath);
            requirejs.config(config);
        } else {
            //exit with task error
            grunt.warn('Cant find ' + requireConfigPath, 3);
        }

        //Find the text files in all requireJS modules
        var root_len = requirejs.toUrl('').replace(/.js$/, '').length;
        //returns the relative module path to the requireJS root path
        function modulePath(moduleName) {
            var modulePath = requirejs.toUrl(moduleName).replace(/.js$/, '').substr(root_len);
            return modulePath;
        };

        //turn settings.DATA_DIRS into array of modules with paths
        var modulePaths = settings.DATA_DIRS.map(function (moduleName) {
            return {
                name: moduleName,
                path modulePaths(moduleName)
            }
        });

        return modulePaths;
    }

    var settings = getSettingsModule();
    settings.modulePaths = getModulePaths(settings);

    return settings;
};

@@ -150,98 +150,8 @@
 );%0A%0A
-    //by default, we load config file from project dir but we allow this to be overridden%0A
     
@@ -300,63 +300,8 @@
   %7D;
-%0A%0A    //setup empty options in case it wasn't passed in
 %0A   

remove duff comments