Added piecewise function macro