rewrite the build system