Added code for Write