added a function to sort filenames properly.