sort out directory