Refactored web-server.js and added comments

Signed-off-by: Daniel Koo <danieljamin.koo@gmail.com>