Creation of smoothing routine
Creation of find_nearest routine