refactored
Merge pull request #3 from sgn11/master

refactored writer