Greatly improved the build script