sorting out directory tree