Refactor build tasks