Simplified the selection of the best solution

Now using lists:max instead of an if statement