updated main with writer support