Various improvements in build system