adapted to the new lib
cleanup
added writer demo