update sam's code ....