Edited algo