Code + UI fixes for document viewer