Refactor ImagesController