Added NPM package.js and grunt; refactoring.