Rewrite WalkMap to reduce stack memory usage.
Don't use pairs in WalkMap