Code cleanup: correct spelling, delete dead code. Externalize dbname string.