Fully functioning algo - testing