Changes to Algo (near final version)