Handle the case where the start or end are out of range, e.g. both -1.
Adjusted visibility of certain methods to allow overriding of the toHttp method.