How do I create an update function