adding updating function