adding function for constructing document from paths