viewer.py : Refactoring