added simple writer
tidy up