Refactor a bit to make pattern matching happy and makeMultipart only work on multipart data.