Add first version of algorithm