working on updating function