Remove some unused variables.

They're set, but not used for anything.
Move variable from module to subroutine.

It's only used in one subroutine and even then for some really small
portion.