refactored modules to use single document from array of documents