Maze Generation in Javascript