added distance calculation to finding closest nodes.