Fix #97 and #103. Fix resource.expansion values.
Remove unused imports.
Small improvements to a few utility classes and functions.
Refactor ReplayBuffer into Byte/BitDecoders.

While we are at it, improve clarity of the method names and fix
several small issues with the read_struct logic. Also improve
method and member documentation in preparation for auto-docs.