restructured Chunk.cpp a bit.