sorting added to getFiles() method