Added encryption to write.