a few changes to the ContactMap function