refactor build system