Fixed bug -- wrong variable.
Eliminate unused variables.