added write mode