amatch for all metrics, added ain function, some documenting