Finished the basic cf algotithm.