Improves the color merging algorithm.