Add comparison functions to library
Rewrite demo to use library
Move chunk parsing into library