added exportChain function