Refactor build helpers