idea: manage the chunks with sqlite instead of files