added dynamic distance
added dynamic distance