a simpler and more performant version for write()

as the subject says - a simpler and faster version for write().