refactoring 'weather.js'