update code style

eliminate pointless use of .createElement() and .appendChild().