refactoring on @vwxyz feedback and a small fix to Gruntfile