Added iAd and refatored the code a bit