add html doctype decl, improve doc and code comments