working on distance computation