Added Write method + tests + comments