Off-by-one error.
Update headers.
Lots of cleanup.