Added sorting. BFS works x1000 faster now