added closest neighbour calculations and saving them to cache file