Add ability to write into a buffer rather than cons one