Pretty much refactored everything. On the plus side, chunking works now.