added max = temp to findBestResult