Code cleanup in list_files