Use @lewing's speedy implementation.