libs build refactoring