added update functionality and test case