minor refactorings to make the build script more flexible