Refactor Functionality out of Image Viewer class