Add instances parameter to instantiateDocument