Modified shaping functions. Will add wnlib