added update function and keeping track of id in objects