changing script.js, structure programming to pattern programming