Added writer code