Implemented piecewise linear functions