setvars optimized