complete writer class with tests