refactor build scripts