updated ad code