Local variable cleanup
First batch of formatting fixes, submitting these before things get massively out of sync again.
I've tried to apply the following rules throughout the code:
- Local variables should be declared within the scope in which they are used.
- Read-only variables should be declared
const
. - Local variables used in only a limit range of the scope should get their own scope.
I've also tried being a bit more explicit in variable and function naming.