Updated js for new implementation