added write functions and toSeries/toSection functions