Refactored serialization to output DSON to a Writer. This will allow writing directly to a file or any other text-stream.