added writeString method