changed write functions to methods
Merge branch 'master' into Dee