My version of a popular algorithm