resolves #46 refactor file processing to be more declarative