Add a chain() function.