Added blending. Code refactoring.