Completed update function and added more test cases which failed