fix the areas i marked in red use the reference image as teh truth