Separated parsing and writing into two classes.