adding writing functionality