implement k-normalization