Reduce variable scope.
Remove unused variables.