simplify and improve new cond var implementation