updated js to new api