minor adjustments to algorithms