Refactor ParseEndpoint() and Endpoint.String()