created two functions in js file.