Refactor build_detail