edited normalize function
Fixed normalization function