Orders files, and deals with directories with more than 1000 items correctly

Fixes #23