Corrected "setenv" misnomer, changed it to "setlocalvar".
Other minor fixes