collapse the multipart/non-multipart cases in a more succinct way