Improve the code with blending and classification