Update to new Javascript API