Update code to new API.