Some JS logic updates