update Nam's code