refactored build system