refactor web.js