Tweaked server & improved event handler in HTML