Implements #97.

Still needs to be tested for performance on a halfway-good computer,
but I'm quite pleased with the current state.