cleaned up calculation of image name