refactored web.js a bit