Finding the best solution possible