trying to polish the image generation process