refactored building process