AJAX page watching support + small cleanup for overall readability and whatnot.

Change-Id: If259bf04f081e161204a1baf678d779877421a4e