Tidy up pdfViewer and added documentation to functions