make the caller determine which names to fix
collapse to one loop