Changes to several algorithms