Updated I/O routines. Added binary and JSON formatters.