Cleanup various algorithms and try to match spec style
Merge pull request #9 from nikomatsakis/master

Cleanup various algorithms and try to match spec style