refactored getBestImageUrl