Use Maze object instead of global functions