refactoring viewport
refactoring viewer and viewport