def word_frequency(document, word_to_frequency = {}):
    """
    Computes the frequencies of words in a given document adding to the existing mapping.

    :param document: to compute word frequencies for
    :param word_to_frequency: existing mapping of words to frequencies from other documents
    :return: the modified word_to_frequency map and the total count of words in the document
    """
    count = 0
    for word in document:
        count += 1
        if word in word_to_frequency:
            word_to_frequency[word] += 1
        else:
            word_to_frequency[word] = 1
    return word_to_frequency, count