Refactored build task