Update the logic to the js file