[web] Improved code and added comments