Migrate some samples to the new API.