Show individual document
Refactor out shared functions in db functionality