added writing to filesystem