Source code refactoring, merged methods with redundant functionality,
euclidean_cost and chebyshev_cost