Refactored the ImageViewer