Slightly reorder the code.
Remove some unused variables.