Implement chain without an extra identity at the end.
minor code style changes