tidy up and mime type.