Switch to new JS API