build system refactored a bit