Improve eval_file function