added clear function to clear allChains and the scope