Refactored some build system utilities.