Changed from uint64 to int64 for Piecewise