Refactoring on ChainContext