correct chunking (todo: cmake, rebase)