Update the code according to those of Tam and Duc