modified code to use js file