Another complete rewrite
Add more supported mimetypes