added xml_to_dict() and improved import logic