Complete refactoring of viewer/__init__.py and ldagibbsviewer.py