More algorithm tweaks and test updates.