testing the aglorithm that doesnt work