profiled the maze and made a few things faster.