parse_file reimplementation