Implemented new distance computation method
Removing some dead code