Adjusting advanced optimizations in grunt file

@XhmikosR Wanna take a look at this and see if I screwed anything up?

Fixes: #395