Replace deprecated APIs and prepare for API result type changes