Algorithm efficiency

And while we're on algorithms....