changed to writable file stream, updated version