Clean up parse_file function