Changes in javascript working