Delete unused variables and unused code paths

Like the title says, this change just deletes some unused variables and unused code paths (assignments to variables that are never read).