moving file processing logic into separate module