Added toDictionary function to List module which returns a mutable dictionary.