Reorganize code and add Grunt.js tasks