Moved ChooseBestResolution method to utils.