adjusting the logic to find image