added normalize function