added update method with tests.