implemented file parsing and writing mechanism