Improve the find highest file function to be much faster