Code review

Assorted thoughts on the maze code - not very organized.

I'd recommend not merging this pull request, but instead looking through it and making comments on the parts you'd like to talk about more.