Moved PiecewiseSearchCost code outside of package.