gofmt.
Refactored some of the code around setting Buffer positions.
Added a test for the buffer package.