simplified code on normalization