changed code for document view