rearranged curl code