refactoring improving file parser