cleaning up the maze code