Fix off-by-one for strings
Full write support, style cleanups, add comments, minor bug fixes