clean up directory listing code, only iterate over the set once (by sorting directori...