Reworked writer class