factorize classes containing columns