wrote a normalization function.