BUG: use cw when computing variances.
Work on sql data.