Migrate samples to the new API.