completed Distance algo and some other fixes
Merge remote-tracking branch 'origin/master'