add file input and filereader logic to writer