Removed Dead Code

Removed dead code and also scooted the var out into the scope that it is actually part of.