Correct algorithm
Changes to source