Did some improvements in JS