Added some code for write support