Various Algorithms & tests