set up splice function so no image is used more than once