.write() logic complete.