First working viewer using ugly code from CImg
refactoring