added update function to set value externally