fixup variable names, clean comments