changes to js file to work consistent