Refactor rebuildTask: to be more clear and reuse code nicer.
Merge remote-tracking branch 'origin/master'