Some cleanup of primordial code and connect match logic