modified maze.py