Updated ads code