Refactored file handling to make file format transparent to all transformations