Not going to insist, but using functions is usually less error prone. And in this case you can even save lines, because you wouldn't have to unset those variables at the end.