refactor mime parser factory