simplify the add/sub_parts code