Make algorithms more type-stable (fix #38)
Merge pull request #49 from timholy/teh/typestability

Make algorithms more type-stable (fix #38)