edited ... added update sample code