creating documents, with control variables