added term distances class