adding write method