Source code refactoring

This functionality also possibly opens up easy extension of new similar costs into the same functionality without copying and pasting code. 
if neither chebychev nor euclidian are true, this function doesn't return anything