added new implementation of cosine blending