QSV: only declare local variables when needed.