Implementing write chapter

Binaries are handled. They are stored in a separate file and referenced with a unique ID instead of the binary value. I think they are being handled in the wrong place however.