Have made refactoring of class Viewer