Reorganized the control flow: added a phase variable so that it can be stopped between algorithms; made a single runinference function.  Seg faults when it's run.
Running. Need to implement any time stopping