move Piecewise handling
Merge pull request #2939 from smichr/piece

move Piecewise handling