added mapAncestralState function