Created an ultimate algorith for finding the best value fro multiple values