Refactoring MIME checks. Again and again