Fix potential unitialized variables.
Reduce variable scope.
Initialize variables in the constructor.