Adds argument to toDocument to replace the data

Updates doc comments