Chunk class and refactorings
Merge chunk refactoring