Functional HEFT algorithm. Starting cleanup.