refactor build process