combineChains function

Function to combine chains