local-ize a couple of variables, code style fixes