Added 'write' command to master function