Fixing my poor understanding of 16-bit arithmetic.
Unnecessary typedef.
More intelligent buffering.
Planned changes.