Refactor this method to mimetypemap in config