Term Distance Function added