getAd function added