Nearest neighbor algorithm can now be changed withouth changing code