moving helper method into MazeGenAlgo