trying to work out the regenerate_image thing