Added update function

should be called with two parameters