refactor weather.js