Implmentations of various algorithms