Port old API code to the new API