algorithm tweaks