Fixed order of files/directories in file search
Added tests for new functionality