Tweaked setVars method