Refactored buffer code

Improved buffer code so that the buffer can be started at an
arbitrary sequence number and handled an edge case that was not
initially apparent. Basically, the acceptable window was not being
properly set