Writing buffer now takes into account the size of the read buffer.
Merge pull request #1 from tinjaw/develop

Writing buffer now takes into account the size of the read buffer.