Refactor rex grunt task