Fixed sorting and missing directory weirdnesses

Closes #4.