some formatting changes and support for multipart/related