An attempt to simplify and speed up the code.

Unfortunately it also makes the result worse. And the speed-up is
marginal, at best.