Added algorithms.

Added the logic flow - had to re-add.