Refactor parse_email method.