Resilience in case of not finding the input file
Some cleanup + test for rewritersample