Added updating function for document