Pull parameters of buffer_init into separate functions.
Add rewind functionality to buffer.