upDated code