refactoring for chunking and SoC