Generalizing chaining to more than 2 objects

Change-Id: If3dec97d383abbb42c3fa4310025ed3b353108e0