refactoring js/script.js