Finished chunking and code finalization

Chunking is done and produces the same result as the native code.
Cleaned up a lot of functions and added some documentation.

Need to rewrite the output functions and the README, and we'll
be ready to start turning this into an R-capable package.