Refactored and improved readability/comments in Main Viewer