Distance Function Added