edited update functionality