Added parsing and writing logic