THIS CODE IS UNTESTED!
Any buffering has been removed. Please test if this causes any performance problems on the device when writing to a file. I don't think merging before testing that would be a good idea.

closes #16