Finished 'best' function