Upadted js for api changes