improved the logic for grabbing images to get more randomized results