Ran Coder checking, cleaned up most of the errors.

Cleaned up almost all errors reported by Coder. For consistent with externally defined names, did not change names of two local vars/params.