writer as well, split off file handling