normalize function implemented