adding writing functions