Filled in some code for distance metric
Debugged distance metric