Modified mainDirective.js