move render logic to writer class