udpated code