Edited algorithm section