Minor code cleanup of variable scope, spelling.