implemented write(), write_nested(). FIXME: read_nested()